package edu.jmu.bean.file;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import edu.jmu.bean.user.User;

@Entity
@Table(name="T_FileInfo")
public class FileInfo implements Serializable{
	private static final long serialVersionUID = -4120397535654882708L;
	private Integer fileId;
	private String fileName;
	private FileInfoType fileInfoType;
	private String remark;
	private User ownUser;
	private Date createDate;
	private FileInfo parentFile;
	private String path;
	private boolean ifDel;
	
	@Id	@GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getFileId() {
		return fileId;
	}
	public void setFileId(Integer fileId) {
		this.fileId = fileId;
	}
	@Column(length=50)
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	@Enumerated(EnumType.STRING)
	@Column(length=10,nullable=false)
	public FileInfoType getFileInfoType() {
		return fileInfoType;
	}
	public void setFileInfoType(FileInfoType fileInfoType) {
		this.fileInfoType = fileInfoType;
	}
	@Column(length=100)
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@ManyToOne(cascade=CascadeType.REFRESH)
	@JoinColumn(name="own_user")
	public User getOwnUser() {
		return ownUser;
	}
	public void setOwnUser(User ownUser) {
		this.ownUser = ownUser;
	}
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	@ManyToOne(cascade=CascadeType.REFRESH)
	@JoinColumn(name="parent_id")
	public FileInfo getParentFile() {
		return parentFile;
	}
	public void setParentFile(FileInfo parentFile) {
		this.parentFile = parentFile;
	}
	@Column(length=100)
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	@Column(length=1)
	public boolean isIfDel() {
		return ifDel;
	}
	public void setIfDel(boolean ifDel) {
		this.ifDel = ifDel;
	}
	
	
	
}
